package game.controller
{
	import flash.utils.getTimer;
	import game.model.building.BuildingConfigProxy;
	import game.model.building.BuildingProxy;
	import game.model.building.vo.BuildingConfigVO;
	import game.model.building.vo.BuildingVO;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author Thot
	 */
	
	public class IncreaseBuildingLevelCommand extends SimpleCommand
	{
		override public function execute( notification:INotification ):void
		{
			var configProxy:BuildingConfigProxy = facade.retrieveProxy(BuildingConfigProxy.NAME) as BuildingConfigProxy;
			var proxy:BuildingProxy = facade.retrieveProxy(BuildingProxy.NAME) as BuildingProxy;
			var configVO:BuildingConfigVO = configProxy.getBuildingConfigBy( "id", notification.getBody().id );
			var buildVO:BuildingVO = proxy.getBuildBy("name", notification.getBody().name);
			
			buildVO.level++;
			buildVO.nextLevelTime 	= configVO.nextLevelTime[buildVO.level];
			buildVO.prodMana 		= configVO.prodMana[buildVO.level];
			buildVO.prodGold 		= configVO.prodGold[buildVO.level];
			buildVO.costGems 		= configVO.costGems[buildVO.level];
			buildVO.costGold 		= configVO.costGold[buildVO.level];
			buildVO.costMana 		= configVO.costMana[buildVO.level];
		}
	}

}